import { GAME_MODE } from "../engines/managers/gameContent/gameMode_json";
import PageBase from "./Base/PageBase";
import { NODE_TYPE } from "./Enum";

export type IGameModeNumberMap = {
    [mode in GAME_MODE]: number;
};
export interface IPagePramsBase {
    mode: GAME_MODE,
    levelInfo?:INormalLevelStruct;
    onClose?: () => void,
    onReward?: () => void,
    index?: number,
    loseText?: string
    hot?: string
}
export interface IWinPagePrams extends IPagePramsBase {
    winText: string,
    index?: number,
    jyInde?: number
}
export interface IUnlockPagePrams extends IPagePramsBase {
    isShowOne:boolean,//是否显示·第一个按钮
    unlockCall:()=>void,//回调----解锁一个关卡的回调
    allCall:()=>void,//回调----解锁所有关卡的回调
    cancel:()=>void,//回调----解锁所有关卡的回调
}


export interface ILosePagePrams extends ITipsPagePrams {
    loseText: string,
    index?: number
}
export interface ITipsPagePrams extends IPagePramsBase {
    tips: string
}
export interface IInGamePagePrams extends ITipsPagePrams {
    title: string,
    hideTitle?:number
}



export interface IConfigMap {
    path: string,
    responName: string
}

export interface ISourceMap {
    mode: GAME_MODE,
    responName: string
}
export interface ISkinMap {
    [id: string]: ISkinPrams
}

export interface ISkinPrams {
    id: string,
    path: string,
    icon: string,
    unlockIcon?: string,
    unlockBtn?: string,
    faceAnim: string,
    faceSkin?: string,
    name: string,

    noAdUnlock?: boolean,
    unlockTips?: string,
    tailWidth?: number,
    tailHeight?: number,
    tailX?: number,
    tailY?: number,

    light_mid_skin: string,
    heavy_mid_skin: string,
    light_tail_skin: string,
    heavy_tail_skin: string,
    light_curved_out_skin: string,
    heavy_curved_out_skin: string,
    light_curved_in_skin: string,
    heavy_curved_in_skin: string,

    mid_anim: string,
    tail_anim: string,
    curved_out_anim: string,
    curved_in_anim: string,
}
export interface IAppleSnakeMap {
    [id: string]: IAppleSnakeLevelStruct
}

export interface IAppleSnakeLevelStruct {
    size: IDir,
    all: ICellInfo[],
    text?: string,
    guideAnims?: string[]
}


export interface IGameModeContent {
    currLevel: number,
    newwestLevel: number,
    shenqiLevel: number,
    wangengLevel: number,
    lianxianLevel: number,
    farLevel: number,
    maxLevel: number,
    unlockLevleList: number[]
}

export type IGameModeMap = {
    [mode in GAME_MODE]: IGameModeContent;
};

export type IGameModeImgMap = {
    [mode in GAME_MODE]: IImgPair
}
export interface IImgPair {
    titleImg: string,
    contentImg: string
}

export type IModeNameMap = {
    [mode in GAME_MODE]: string
}

export interface IPageMap {
    [pageName: string]: PageBase;
}

export interface ICellInfo {
    pos: IDir,
    dir: number,
    type: NODE_TYPE
}

export interface IGuideMap {
    [id: number]: number[]
}


export interface INormalLevelStruct {
    bundleName: string,
    /**mode 加载的包名 如果填写 会直接强制去load mode Id 所指向的bundleName 方便各游戏穿插调佣 */
    subPower:number,
    mode: GAME_MODE,
    name: string,
    tips: string,
    title: string,
    winText: string,
    loseText?: string,
    level?: number,
    levelType?: number,
    sourceLevel?: number,
    reward?: boolean,
    gameAloneBundle?: string,
    oldLevel:number,
    hideTitle?:number,
    infinityFlag:boolean,
    levelNum:number,
}

export interface IAppleSnakeLevelStruct {
    size: IDir,
    all: ICellInfo[],
    text?: string,
    guideAnims?: string[]
}

export interface ILevelMap {
    [id: number]: INormalLevelStruct
}

export interface ILevelInfo {
    id: number,
    content: INormalLevelStruct
}

//#region 参数型接口
export interface IDir {
    x: number,
    y: number
}
//#endregion


//#region 推箱子接口
export interface PushBoxLevelInfo {
    id: number,
    size: MapSize,
    content: PushBoxGrid[]
}

export interface MapSize {
    x: number,
    y: number
}

export interface PushBoxGrid {//推箱子格子信息
    x: number,
    y: number,
    type: GridPutType
}

export interface PutGridItem {
    type: GridPutType,
    node: cc.Node
}

export enum GridPutType {
    Player,//玩家
    Box,//箱子
    Wall,//墙壁
    Final,//终点
}

export enum PushBoxFoward {
    UP,
    Down,
    Left,
    Right
}

export interface BackInfo {//退回信息
    Front: PutGridItem[],
    Post: PutGridItem[],
    pref: cc.Node,
    last: cc.Node
}
//#endregion

//#region 猜地名接口
export interface GuessPlceLevelInfo {
    id: number,
    result: string,
    subject: string[],
    right: number
}
//#endregion

export interface ISoundQuestionInfo {
    question: string,
    rightAnswer: number,
    answerArr: string[],
    QsoundName: string,
    TSoundName: string,
    TTime: number,
    QTime: number
}